//
//  AuditSuggestViewController.m
//  YunKang
//
//  Created by leoking870 on 2017/10/3.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import "YKAuditSuggestViewController.h"
#import "YKPopupView.h"
@interface YKAuditSuggestViewController ()
@property (nonatomic,strong)UITextView *textView;
@end

@implementation YKAuditSuggestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    UILabel *titleLabel = [[UILabel alloc]init];
    titleLabel.text = @"审批意见";
    titleLabel.textColor = [UIColor tf_colorWithHexString:@"#444444"];
    titleLabel.font = [UIFont systemFontOfSize:15];
    [self.view addSubview:titleLabel];
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.view);
        make.top.equalTo(self.view).offset(11);
    }];
    
    UIButton *submitButton = [[UIButton alloc]init];
    [submitButton setTitle:@"提交" forState:UIControlStateNormal];
    [submitButton setBackgroundColor:TFSTYLE(buttonEnableBackgroundColor)];
    [submitButton setTitleColor:TFSTYLE(buttonEnableTitleColor) forState:UIControlStateNormal];
    [self.view addSubview:submitButton];
    [submitButton addTarget:self action:@selector(onSubmitButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
    [submitButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.bottom.trailing.equalTo(self.view);
        make.height.mas_equalTo(40);
    }];
    submitButton.titleLabel.font = [UIFont systemFontOfSize:14];
    submitButton.layer.cornerRadius = 5;
    
    UITextView *textView = [[UITextView alloc]init];
    textView.backgroundColor = [UIColor tf_colorWithHexString:@"#f2f2f2"];
    [self.view addSubview:textView];
    [textView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.equalTo(self.view);
        make.top.equalTo(titleLabel.mas_bottom).offset(11);
        make.bottom.equalTo(submitButton.mas_top).offset(-11);
    }];
    self.textView = textView;
}
- (void)onSubmitButtonTapped:(id)sender {
    if (self.textView.text.length == 0) {
        [self showHint:@"请输入审批意见"];
        return;
    }
    if (self.submitBlock) {
        self.submitBlock(self.textView.text);
    }
    [YKPopupView dismissViewController:self];
}

@end
